clear all

use  "${raw}/nepal/raw/nepal_seasonality", clear

gen month_seas = month(date)
tab date month_seas
collapse (mean) ctrl_seas = ___foodIns_r, by(month_seas)
tempfile month_seas
save `month_seas'

clear all
set obs 426
gen date = mdy(12,1,2020) + _n
gen day = doy(date)
gen month_seas = month(date)
gen d = _n
merge m:1 month_seas using `month_seas'


lowess ctrl_seas d, bw(.2) gen(_ctrl_seas)
tw scatter _ctrl_seas day, col(%20) msize(small)

collapse (mean) _ctrl_seas , by(day)

ren day day_seas
keep day_seas _ctrl_seas
duplicates drop
isid day_seas
save "${raw}/nepal/nepal_seas.dta", replace
